import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from 'typeorm';
import { Dictionary } from './dictionary.entity';
import { ApiProperty } from '@nestjs/swagger'
@Entity('dictionary_item')
export class DictionaryItem {
    @ApiProperty({
        description: 'id', default: null, type: 'int',
        example: 1, required: false,
    })
    @PrimaryGeneratedColumn()
    id: number;

    @ApiProperty({
        description: 'key', default: null, type: 'string',
        example: '', required: true,
    })
    @Column()
    key: string;


    @ApiProperty({
        description: 'value', default: null, type: 'string',
        example: '', required: false,
    })
    @Column()
    value: string;


    @ApiProperty({
        description: 'dictionary', default: null, type: 'json',
        example: '', required: false,
    })
    @ManyToOne(() => Dictionary, dictionary => dictionary.items)
    @JoinColumn({ name: 'dictionary_id' })
    dictionary: Dictionary;
}